#include <bits/stdc++.h>
using namespace std;
using uint=unsigned int;
using ll=long long;
using ull=unsigned long long;
using i128=__int128;
const int N=1e6+5;

int gcd(int a,int b){
    return b?gcd(b,a%b):a;
}
int lcm(int a,int b){
    return (a/gcd(a,b))*b;
}

void solve(){
    string s;
    cin>>s;
    bool check=1;
    for(int i=0;i<s.size();i++){
        if(s[i]<'0'||s[i]>'9')check=0;
    }
    if(check){
        cout<<s<<endl;
        return;
    }
    int zi=0,mu=1;
    for(int i=0;i<s.size();i++){
        if(s[i]=='/'){
            int f=1;
            int curzi=0;
            int l=i-1;
            while(s[l]>='0'&&s[l]<='9'&&l>=0){
                curzi=curzi*10+s[l]-'0';
                l--;
            }
            if(i-2>=0){
                if(s[i-2]=='-')f=-1;
            }
            int curmu=0;
            int r=i+1;
            while(s[r]>='0'&&s[r]<='9'&&r<s.size()){
                curmu=curmu*10+s[r]-'0';
                r++;
            }
            int tmu=lcm(curmu,mu);
            int tzi=zi*(tmu/mu);
            tzi+=curzi*(tmu/curmu)*f;
            int temp=gcd(abs(tzi),tmu);
            zi=tzi/temp;
            mu=tmu/temp;
        }
    }
    if(zi==0)cout<<"0"<<endl;
    else if(zi%mu==0)cout<<zi/mu<<endl;
    else cout<<zi<<"/"<<mu<<endl;
    return;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    solve();
    

    return 0;
}